package cn.sinata.wanglin.net;
import android.content.Context;
import android.text.TextUtils;

import com.alibaba.sdk.android.oss.ClientException;
import com.alibaba.sdk.android.oss.OSS;
import com.alibaba.sdk.android.oss.OSSClient;
import com.alibaba.sdk.android.oss.ServiceException;
import com.alibaba.sdk.android.oss.common.auth.OSSCredentialProvider;
import com.alibaba.sdk.android.oss.common.auth.OSSPlainTextAKSKCredentialProvider;
import com.alibaba.sdk.android.oss.model.PutObjectRequest;
import com.google.gson.JsonObject;
import com.xilada.xldutils.utils.Md5;
import com.xilada.xldutils.utils.Utils;

import java.io.File;
import java.util.ArrayList;

import cn.sinata.util.DES;
import cn.sinata.wanglin.MyApplication;
import cn.sinata.wanglin.aliyunoss.OssBean;
import cn.sinata.wanglin.aliyunoss.OssMyUtils;
import cn.sinata.wanglin.commonutils.Constant;
import cn.sinata.wanglin.db.model.User;
import cn.sinata.wanglin.model.Active;
import cn.sinata.wanglin.model.ActiveDetails;
import cn.sinata.wanglin.model.AppBannerInfo;
import cn.sinata.wanglin.model.BindPhoneInfo;
import cn.sinata.wanglin.model.Circle;
import cn.sinata.wanglin.model.CircleMessage;
import cn.sinata.wanglin.model.Comment;
import cn.sinata.wanglin.model.CommentBean;
import cn.sinata.wanglin.model.Contact;
import cn.sinata.wanglin.model.Group;
import cn.sinata.wanglin.model.GroupList;
import cn.sinata.wanglin.model.Imageinfo;
import cn.sinata.wanglin.model.IsFriendInfo;
import cn.sinata.wanglin.model.LikeData;
import cn.sinata.wanglin.model.LoginInfo;
import cn.sinata.wanglin.model.Makecomplaints;
import cn.sinata.wanglin.model.Message;
import cn.sinata.wanglin.model.MyDynamicInfo;
import cn.sinata.wanglin.model.MyVillage;
import cn.sinata.wanglin.model.MyLeadMaterial;
import cn.sinata.wanglin.model.Myrepair;
import cn.sinata.wanglin.model.NewFriend;
import cn.sinata.wanglin.model.Newsinfo;
import cn.sinata.wanglin.model.NewsinfoDetails;
import cn.sinata.wanglin.model.PropertyHome;
import cn.sinata.wanglin.model.RepairDetail;
import cn.sinata.wanglin.model.RepairRecord;
import cn.sinata.wanglin.model.SameCityClass;
import cn.sinata.wanglin.model.SameCityInfo;
import cn.sinata.wanglin.model.SearchUser;
import cn.sinata.wanglin.model.SendToMeBean;
import cn.sinata.wanglin.model.Shieldperson;
import cn.sinata.wanglin.model.SignupUserBean;
import cn.sinata.wanglin.model.TuCaoAndSameCityDetailInfo;
import cn.sinata.wanglin.model.Userinfo;
import cn.sinata.wanglin.model.Village;
import cn.sinata.wanglin.model.VillageNeighbor;
import cn.sinata.wanglin.model.WeatherInfo;
import cn.sinata.wanglin.net.model.ResultData;
import cn.sinata.wanglin.utils.StringToUtils;
import rx.Observable;
import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 *
 * Created by liaoxiang on 16/6/20.
 */
public class HttpManager {

    public static final String REQUEST_ERROR = "请求出错！";
    public static final String PARSER_ERROR = "数据解析出错！";
    public static final String NET_ERROR = "网络异常，请检查您的网络状态！";
    public static final int PAGE_SIZE = 20;
    public static final boolean encodeDes = true;
    public static final boolean decodeDes = true;

    private static class ParamsBuilder{
        public static final String SPLIT = "=";
        public static final String AND = "&";
        private StringBuilder sb;
        private ParamsBuilder(){
            sb = new StringBuilder();
        }
        public static ParamsBuilder create(){
            return new ParamsBuilder();
        }
        public String build(){
            //最后一个字符不是&就是？。
            //防止最后一位不是&或者？被多次调用打印时错误删除
            char end = sb.charAt(sb.length() - 1);
            if (end == '&' || end == '?') {
                sb.deleteCharAt(sb.length()-1);
            }
            return sb.toString();
        }

        public String build(boolean des){
            if (des){
                //最后一个字符不是&就是？。
                //防止最后一位不是&或者？被多次调用打印时错误删除
                char end = sb.charAt(sb.length() - 1);
                if (end == '&' || end == '?') {
                    sb.deleteCharAt(sb.length()-1);
                }
                Utils.systemErr(sb.toString());
                return DES.encryptDES(sb.toString());
            }else {
                //最后一个字符不是&就是？。
                //防止最后一位不是&或者？被多次调用打印时错误删除
                char end = sb.charAt(sb.length() - 1);
                if (end == '&' || end == '?') {
                    sb.deleteCharAt(sb.length()-1);
                }
                sb.deleteCharAt(sb.length()-1);
                return sb.toString();
            }
        }
        public ParamsBuilder append(String key, String value){
            _append(key,value);
            return this;
        }

        public ParamsBuilder append(String key , int value){
            _append(key,value);
            return this;
        }

        public ParamsBuilder append(String key , double value){
            _append(key,value);
            return this;
        }

        public ParamsBuilder append(String key , float value){
            _append(key,value);
            return this;
        }
        public ParamsBuilder append(String key , long value){
            _append(key,value);
            return this;
        }
        private void _append(String key, Object value){
            if (value instanceof String){

                if ("null".equals(value) || TextUtils.isEmpty(value.toString())) {
                    value = "";
                }
            }
            if (sb.length() == 0){
                sb.append(value+"?");
            }else {
                sb.append(key);
                sb.append(SPLIT);
                sb.append(StringToUtils.URLEncode(value+""));
                sb.append(AND);
            }
        }

    }
    /**
     * 获取天气接口
     * @return 数据
     */
    public static Observable<WeatherInfo> getWeatherByCityName(){
        String url="http://api.map.baidu.com/telematics/v3/";
        return new RRetrofit(url).createOther(ApiService.class).getWeatherByCityName(MyApplication.city,"json","com.wanglinkeji.WangLinapp","yuGg6aXFxGcNQwqWffhu1FppFZavOrAz").subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
    /**
     * 获取广告页
     * @return 数据
     */
    public static Observable<ResultData<AppBannerInfo>> getStartPage(){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_START_PAGE);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build());
        return RRetrofit.getInstance().create(ApiService.class).getStartPage(key);
    }
    public static Observable<String> uploadFile(Context context, File file){

        // 明文设置secret的方式建议只在测试时使用，更多鉴权模式请参考后面的`访问控制`章节
        OSSCredentialProvider credentialProvider = new OSSPlainTextAKSKCredentialProvider(OssMyUtils.accessKeyId, OssMyUtils.accessKeySecret);
        final OSS oss = new OSSClient(context.getApplicationContext(), OssMyUtils.endpoint, credentialProvider);
        final String objectKey = "wanglin/image/"+ System.currentTimeMillis()+"."+Utils.getFileSuffix(file);
        // 构造上传请求
        final PutObjectRequest put = new PutObjectRequest(OssMyUtils.myBucket, objectKey, file.getPath());
        return Observable.create(new Observable.OnSubscribe<String>() {
            @Override
            public void call(Subscriber<? super String> subscriber) {
                subscriber.onStart();
                try {
                    oss.putObject(put);
                    String url = oss.presignPublicObjectURL(OssMyUtils.myBucket, objectKey);
                    subscriber.onNext(url);
                    subscriber.onCompleted();
                } catch (ClientException | ServiceException e) {
                    e.printStackTrace();
                    subscriber.onError(e);
                }
            }
        }).subscribeOn(Schedulers.io());
    }

    /**
     * 登录
     * @param phone 手机号
     * @param password 密码
     * @return 登录结果
     */
    public static Observable<ResultData<LoginInfo>> login(String phone, String password){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.LOGIN)
                .append("phone",phone)
                .append("password", Md5.getMd5Value(password));
        String key=builder.build(encodeDes);
        return RRetrofit.getInstance().create(ApiService.class).login(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
    /**
     * 是否是好友
     * String userId, String friendId
     * @return 登录结果
     */
    public static Observable<ResultData<IsFriendInfo>> isFriend(String userId, String friendId){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.IS_FRIEND)
                .append("userId",userId)
                .append("friendId",friendId);
        String key=builder.build(encodeDes);
        return RRetrofit.getInstance().create(ApiService.class).isFriend(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 授权登录
     * openID	是	string	授权ID
     authType	是	string	授权类型（A:qq B : 微信）
     nickName	否	string	昵称
     headUrl	否	string	头像
     sex	否	string	性别
     birthday	否	string	生日
     */
    public static Observable<ResultData<LoginInfo>> authLogin(String openID, String authType,String headUrl,String nickName,String sex){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.AUTH_LOGIN)
                .append("openID",openID)
                .append("authType", authType);
        if(!TextUtils.isEmpty(nickName)){
            builder.append("nickName", nickName);
        }
        if(!TextUtils.isEmpty(headUrl)){
            builder.append("headUrl", headUrl);
        }
        //性别（0：男；1：女）
        if(!TextUtils.isEmpty(sex)&&"男".equals(sex)){
            builder.append("sex", "0");
        }else{
            builder.append("sex", "1");
        }

        String key=builder.build(encodeDes);
        return RRetrofit.getInstance().create(ApiService.class).login(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 获取短信验证码
     * @param phone 用户电话
     * @param type 验证码类型（A:找回密码；B：注册）
     * @return 验证码
     */
    public static Observable<ResultData<JsonObject>> sendCodeSms(String phone,String type){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.SEND_CODE_SMS)
                .append("phone",phone)
                .append("type",type);
        String key=builder.build(encodeDes);
        Utils.systemErr(key);
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 忘记密码
     * @param phone 电话号码
     * @param smscode 短信验证码
     * @param pwd 密码
     * @return
     */
    public static Observable<ResultData<JsonObject>> alterPwd(String phone,String smscode,String pwd){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.FORGET_PASSWORD)
                .append("phone",phone)
                .append("msgCode",smscode)
                .append("password",Md5.getMd5Value(pwd));
        String key=builder.build(encodeDes);
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
    /**
     * 修改密码
     userID	是	int	用户ID
     password	是	string	密码
     newPassword	是	string	新密码
     * @return
     */
    public static Observable<ResultData<JsonObject>> alterForUpdatePwd(String userID,String password,String newPassword){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.ALTER_PASSWORD)
                .append("userID",userID)
                .append("password",Md5.getMd5Value(password))
                .append("newPassword",Md5.getMd5Value(newPassword));
        String key=builder.build(encodeDes);
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 注册并登录
     * @param phone 电话号码
     * @param smscode 短信验证码
     * @param pwd 密码
     * @return
     */
    public static Observable<ResultData<LoginInfo>> doRigsterAndLogin(String phone,String smscode,String pwd){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.REGISTER_AND_LOGIN)
                .append("phone",phone)
                .append("msgCode",smscode)
                .append("password", Md5.getMd5Value(pwd));
        String key=builder.build(encodeDes);
        return RRetrofit.getInstance().create(ApiService.class).dorigisterandlogin(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 获取个人信息页面
     * @param userid
     * @return
     */
    public static Observable<ResultData<Userinfo>> getUserinfo(String userid,String friendID){
        return getUserinfo(userid,friendID,0);
    }
    public static Observable<ResultData<Userinfo>> getUserinfo(String userid,String friendID,int type){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_USERINFO)
                .append("userID",userid);
        if (type >= 1) {
            builder.append("account", friendID);
        } else {
            builder.append("friendID",friendID);
        }
        String key=builder.build(encodeDes);
        return RRetrofit.getInstance().create(ApiService.class).getuserinfo(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());

    }

    /**
     * 修改个人信息接口除标签外。
     * @param userid
     * @param msg
     * @param tag
     * @return
     */
    public static Observable<ResultData<JsonObject>> updUser(String userid,String msg,int tag){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.UPD_USER)
                .append("id",userid);
        switch (tag){
            case Constant.ALT_nickName:
                //修改昵称
                builder.append("nickName",msg);
                break;
            case Constant.ALT_headUrl:
                //修改头衔
                builder.append("headUrl",msg);
                break;
            case Constant.ALT_sex:
                //修改性别
                builder.append("sex",msg);
                break;
            case Constant.ALT_birthday:
                //修改出生年月
                builder.append("birthday",msg);
                break;
            case Constant.ALT_housingID:
                //修改绑定小区ID
                builder.append("housingID",msg);
                break;
            case Constant.ALT_character:
                //修改个性签名
                builder.append("character",msg);
                break;
            case Constant.ALT_industry:
                //修改行业
                builder.append("industry",msg);
                break;
            case Constant.ALT_isforeign:
                // 是否验证小区以外的人(0：是，1：否)
                builder.append("isforeign",msg);
                break;
            case Constant.ALT_valid:
                //加好友时，需要验证（0：是，1：否）
                builder.append("valid",msg);
                break;

        }
        String key=builder.build(encodeDes);
        return RRetrofit.getInstance().create(ApiService.class).upduser(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 修改标签接口
     * @param userid
     * @param belongLabel
     * @param otherLabel
     * @return
     */
    public static Observable<ResultData<JsonObject>> altLable(String userid,String belongLabel,String otherLabel){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.UPD_USER)
                .append("id",userid);
        builder.append("belongLabel",belongLabel);
        builder.append("otherLabel",otherLabel);
        String key=builder.build(encodeDes);
        return RRetrofit.getInstance().create(ApiService.class).upduser(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
    public static Observable<ResultData<JsonObject>> houseAuthentication(String userid,String housingId,String building, String unit,String floor,String doorNumber, String authType,String ownerType, String imgUrl,String scale){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.AUTHEN_HOUSE)
                .append("userId",userid);
        builder.append("housingId",housingId);
        builder.append("building",building);
        builder.append("unit",unit);
        builder.append("floor",floor);
        builder.append("doorNumber",doorNumber);
        builder.append("authType",authType);
        builder.append("ownerType",ownerType);
        builder.append("imgUrl",imgUrl);
        builder.append("scale",scale);
        String key=builder.build(encodeDes);
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 获取我的小区
     * @param userID 用户id
     * @return
     */
    public static Observable<ResultData<ArrayList<MyVillage>>> getMyVillage(String userID){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_MY_HOUSING)
                .append("userID",userID);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getMyVillage(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
    /**
     * 设置我的默认小区
     * @param userID 用户id
     * @param ownerID 认证小区ID
     * @return
     */
    public static Observable<ResultData<JsonObject>> defaultHousing(String userID,String ownerID){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.SET_DEFAULT_HOUSING)
                .append("userID",userID)
                .append("ownerID",ownerID);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
    /**
     * 删除小区
     * @param id 认证小区ID
     * @return
     */
    public static Observable<ResultData<JsonObject>> delHousing(String id,String userID){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.DELETE_HOUSING)
                .append("userID",userID)
                .append("id",id);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
    /**
     * 获取我的报修数据
     * @param userID
     * @param startIndex
     * @return
     */
    public static Observable<ResultData<ArrayList<Myrepair>>> getRepairList(String userID, int startIndex){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_REPAIRLIST)
                .append("userID",userID)
                .append("startIndex",startIndex)
                .append("rows",PAGE_SIZE);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getRepairList(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
    /**
     * 获取我的报修数据
     * @return
     */
    public static Observable<ResultData<Myrepair>> getRepairInfo(String repairID){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.REPAIR_INFO)
                .append("repairID",repairID);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getRepairInfo(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 报修详情
     * @param repairID
     * @return
     */
    public static Observable<ResultData<RepairDetail>> getRepairDetail(String repairID){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.REPAIR_DETAIL)
                .append("id",repairID);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getRepairDetail(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 获取我的领物数据
     * @param userID
     * @param startIndex
     * @return
     */
    public static Observable<ResultData<ArrayList<MyLeadMaterial>>> getDepositList(String userID, int startIndex){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_DEPOSITLIST)
                .append("userID",userID)
                .append("startIndex",startIndex)
                .append("rows",PAGE_SIZE);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getDepositList(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
    /**
     * 上传个人相册
     */
    public static Observable<ResultData<ArrayList<Imageinfo>>> uploadImg(String userID, String imgUrl){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.UPLOAD_IMG)
                .append("imgs",imgUrl);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).uploadImg(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
    /**
     * 删除个人相册
     */
    public static Observable<ResultData<JsonObject>> delImg(String imgID){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.DELETE_IMG)
                .append("imgID",imgID);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
    /**
     * userId	是	int	用户id
     type	是	String	类型（A：同城八卦；B:吐槽;C：圈子）
     content	是	String	发布内容
     status	是	String	0不匿名 1匿名
     isCircle	是	String	是否同步圈子 0同步 1不同步
     isComplaints	是	String	是否同步小区吐槽 0同步 1不同步
     isGossip	是	String	是否同步同城八卦 0同步 1不同步
     code	是	String	定位code 用于同城搜索 （同城八卦）
     classifyId	否	int	同城八卦的分类id（同城八卦）
     housingId	否	int	小区id（小区吐槽）
     img1	否	String	图片路径
     img2	否	String	图片路径
     img3	否	String	图片路径
     img4	否	String	图片路径
     img5	否	String	图片路径
     img6	否	String	图片路径
     img7	否	String	图片路径
     img8	否	String	图片路径
     img9	否	String	图片路径
     scale	是	String	宽除以高 如（0.5,1,0.5,0.5） 多张用逗号隔开
     */
    public static Observable<ResultData<JsonObject>> addRelease(
            String userId, String type, String content,
            String status, String isCircle, String isComplaints,
            String isGossip, String code, String classifyId, String housingId, String scale, ArrayList<OssBean> mOssBeans){
//        //编码内容，输入法emoji表情处理
//        content = StringToUtils.URLEncode(content);

        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.ADD_RELEASE)
                .append("userId",userId)
                .append("type",type)
                .append("content", content)
                .append("status",status)
                .append("isCircle",isCircle)
                .append("isComplaints",isComplaints)
                .append("isGossip",isGossip)
                .append("code",code);
        if(!TextUtils.isEmpty(classifyId)){
            builder .append("classifyId",classifyId) ;
        }
        if(!TextUtils.isEmpty(housingId)){
            builder .append("housingId",housingId) ;
        }
        if (!TextUtils.isEmpty(scale)) {
            builder.append("scale",scale);
        }
        if(mOssBeans!=null&&mOssBeans.size()!=0){
            for(int i=0;i<mOssBeans.size();i++){
                builder .append("img"+(i+1),mOssBeans.get(i).getUrlkey()) ;
            }

        }
        String key=builder.build(encodeDes);
        Utils.systemErr(key);
        Utils.systemErr(key.length());
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<ResultData<ArrayList<SameCityClass>>> getClassify(){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_CLASSIFY);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getClassify(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 添加活动
     * userId	是	int	用户id
     housingId	是	int	小区id
     title	是	String	活动标题
     startTime	是	String	活动开始时间（yyyy-MM-dd HH:mm）
     endTime	是	String	活动结束时间 （yyyy-MM-dd HH:mm）
     address	是	String	活动地址
     exes	是	Double	活动费用
     people	是	int	参加人数 -1：无限制
     phone	是	String	联系电话
     remark	是	String	活动描述
     poster	是	String	活动海报图片路径
     scale	是	String	宽除以高的值 如（0.5）
     */
    public static Observable<ResultData<JsonObject>> addActivity(String userId,String housingId,String title,String startTime,
                                                                 String endTime,String address,String exes,String people,
                                                                 String phone,String remark,String poster,String scale,
                                                                 String longitude,String latitude){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.ADD_ACTIVITY)
                .append("userId",userId)
                .append("housingId",housingId)
                .append("title",title)
                .append("userId",userId)
                .append("startTime",startTime)
                .append("endTime",endTime)
                .append("address",address)
                .append("exes",exes)
                .append("people",people)
                .append("phone",phone)
                .append("remark",remark)
                .append("poster",poster)
                .append("scale",scale)
                .append("longitude",longitude)
                .append("latitude",latitude);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 获取小区动态---吐槽接口
     * @param userId
     * @param housingId
     * @param pageNo
     * @return
     */
    public static Observable<ResultData<ArrayList<Makecomplaints>>> getHousingDynamic(String userId, String housingId, int pageNo){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_HOUSING_DYNAMIC)
                .append("userId",userId)
                .append("housingId",housingId)
                .append("type","1")
                .append("pageNo",pageNo)
                .append("pageSize",10);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getHousingDynamic(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
    /**
     * 获取小区动态---活动接口
     * @param userId
     * @param housingId
     * @param pageNo
     * @return
     */
    public static Observable<ResultData<ArrayList<Active>>> getHousingDynamicFromActive(String userId, String housingId, int pageNo){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_HOUSING_DYNAMIC)
                .append("userId",userId)
                .append("housingId",housingId)
                .append("type","2")
                .append("pageNo",pageNo)
                .append("pageSize",10);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getHousingDynamicFromActive(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 获取新闻资讯
     * @param sort
     * @param pageNo
     * @return
     */
    public static Observable<ResultData<ArrayList<Newsinfo>>> getNews(String sort, int pageNo){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_NEWS)
                .append("sort",sort)
                .append("pageNo",pageNo)
                .append("pageSize",PAGE_SIZE);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getNews(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     *获取同城八卦列表接口
     * 参数名	必选	类型	说明
     userId	是	Integer	用户id
     classifyId	是	Integer	同城八卦分类id
     code	是	String	城市代码
     pageNo	是	Integer	起始页（0开始）
     pageSize	是	Integer	每页显示条数
     */
    public static Observable<ResultData<ArrayList<SameCityInfo>>> getGossipComment(String userId, String classifyId,String code, int pageNo){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_GOSSIPCOMMENT)
                .append("userId",userId)
                .append("classifyId",classifyId)
                .append("code",code)
                .append("pageNo",pageNo)
                .append("pageSize",10);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getGossipComment(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
    /**
     *获取同城八卦列表接口
     userId	是	Integer	用户id
     id	是	Integer	文章内容id
     type	是	String	类型1 小区吐槽 2同城八卦 3小区活动详情 4新闻详情
     pageNo	是	Integer	起始页（0开始，评论分页）
     pageSize	是	Integer	每页显示条数（评论分页）
     */
    public static Observable<ResultData<TuCaoAndSameCityDetailInfo>> getTuCaoOrSameCityDetail(String userId, String id, String type, int pageNo){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_TEXTINFO)
                .append("userId",userId)
                .append("id",id)
                .append("type",type)
                .append("pageNo",pageNo)
                .append("pageSize",10);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getTuCaoOrSameCityDetail(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
    /**
     *获取同城八卦列表接口
     userId	是	Integer	用户id
     id	是	Integer	文章内容id
     type	是	String	类型1 小区吐槽 2同城八卦 3小区活动详情 4新闻详情
     pageNo	是	Integer	起始页（0开始，评论分页）
     pageSize	是	Integer	每页显示条数（评论分页）
     */
    public static Observable<ResultData<ActiveDetails>> getActiveDetail(String userId, String id, int pageNo){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_TEXTINFO)
                .append("userId",userId)
                .append("id",id)
                .append("type","3")
                .append("pageNo",pageNo)
                .append("pageSize",10);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getActiveDetail(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
    /**
     *获取同城八卦列表接口
     userId	是	Integer	用户id
     id	是	Integer	文章内容id
     type	是	String	类型1 小区吐槽 2同城八卦 3小区活动详情 4新闻详情
     pageNo	是	Integer	起始页（0开始，评论分页）
     pageSize	是	Integer	每页显示条数（评论分页）
     */
    public static Observable<ResultData<NewsinfoDetails>> getNewsinfoDetail(String userId, String id, int pageNo){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_TEXTINFO)
                .append("userId",userId)
                .append("id",id)
                .append("type","4")
                .append("pageNo",pageNo)
                .append("pageSize",1);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getNewsinfoDetail(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 获取报名列表接口
     * @param activityID
     * @return
     */
    public static Observable<ResultData<ArrayList<SignupUserBean>>> getSignupInfo(String activityID){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_SIGNUP_INFO)
                .append("activityID",activityID);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getSignupInfo(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * @我的接口
     * @param userId
     * @param pageNo
     * @return
     */
    public static Observable<ResultData<ArrayList<SendToMeBean>>> getSendMy(String userId, int pageNo){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_SEND_MY)
                .append("userId",userId)
                .append("pageNo",pageNo)
                .append("pageSize",PAGE_SIZE);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getSendMy(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 清空@我的接口
     * @param userId
     * @return
     */
    public static Observable<ResultData<JsonObject>> emptyMy(String userId){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_EMPTY_MY)
                .append("userId",userId);
        String key=builder.build(encodeDes);
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 我的--我发布的吐槽和八卦
     * @param userId
     * @param type 1 吐槽 2八卦
     * @return
     */
    public static Observable<ResultData<ArrayList<Makecomplaints>>> getMyZone(String userId,int type, int pageNo,int pageSize){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_MYZONE)
                .append("userId",userId)
                .append("type",""+type)
                .append("pageNo",pageNo)
                .append("pageSize",pageSize);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getHousingDynamic(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 消息中心
     * @param userId
     * @param type 消息类型（0：公告，1：系统消息）
     * @param pageNo
     * @return
     */
    public static Observable<ResultData<ArrayList<Message>>> getNoticeOrMessages(String userId,int type, int pageNo){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_MESSAGES)
                .append("userId",userId)
                .append("type",""+type)
                .append("pageNo",pageNo)
                .append("pageSize",PAGE_SIZE);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getNoticeOrMessages(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
    /**
     * 上传个人相册
     */
    public static Observable<ResultData<JsonObject>> feedback(String userID,String content,String imgUrl){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.FEED_BACK)
                .append("userID",userID)
                .append("content",content)
                .append("imgs",imgUrl);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
    /**
     * 举报
     */
    public static Observable<ResultData<JsonObject>> report(String userId,String reportId,String reportContent,String imgList){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.REPORT)
                .append("userId",userId)
                .append("reportId",reportId)
                .append("reportContent",reportContent)
                .append("imgList",imgList);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
    /**
     * 屏蔽或者拉入黑名单
     * 类型 0：屏蔽；1:黑名单
     */
    public static Observable<ResultData<JsonObject>> shieldOrBlack(String userId,String otherId,String blackType){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.SHIELD_OR_BLACK)
                .append("userId",userId)
                .append("otherId",otherId)
                .append("blackType",blackType);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 消息中心
     * @param userId
     * blackType	是	string	类型（0：屏蔽；1：黑名单）
     */
    public static Observable<ResultData<ArrayList<Shieldperson>>> blackList(String userId, int type){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_BLACKLIST)
                .append("userID",userId)
                .append("blackType",""+type);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).blackList(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
    /**
     * 解除黑名单，屏蔽人
     */
    public static Observable<ResultData<JsonObject>> removeBlacklist(String blackID){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.REMOVE_BLACKLIST)
                .append("blackID",blackID);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
    /**
     * 活动报名
     */
    public static Observable<ResultData<JsonObject>> applyActivity(String userId,String activityId,String name,String phone){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.APPLY_ACTIVITY)
                .append("userId",userId)
                .append("activityId",activityId)
                .append("name",name)
                .append("phone",phone);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 活动报名
     */
    public static Observable<ResultData<JsonObject>> submitApprove(String userID,String approveType,String drivingCard,String travelCard,String diploma ,String visitingCard){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.SUBMIT_APPROVE)
                .append("userID",userID)
                .append("approveType",approveType);
        if(!TextUtils.isEmpty(drivingCard)){
            builder.append("drivingCard",drivingCard);
        }
        if(!TextUtils.isEmpty(travelCard)){
            builder.append("travelCard",travelCard);
        }
        if(!TextUtils.isEmpty(diploma)){
            builder.append("diploma",diploma);
        }
        if(!TextUtils.isEmpty(visitingCard)){
            builder.append("visitingCard",visitingCard);
        }
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }


    /**
     * 小区活动（我发布的）
     * @param userId
     * @param pageNo
     * @return
     */
    public static Observable<ResultData<ArrayList<Active>>> getMyActivity(String userId, int pageNo){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.MY_ACTIVITY)
                .append("userId",userId)
                .append("startIndex",pageNo)
                .append("rows",10);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getHousingDynamicFromActive(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
    /**
     * 小区活动（我参与的）
     * @param userId
     * @param pageNo
     * @return
     */
    public static Observable<ResultData<ArrayList<Active>>> getTakeActivity(String userId, int pageNo){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.TAKE_ACTIVITY)
                .append("userID",userId)
                .append("startIndex",pageNo)
                .append("rows",10);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getHousingDynamicFromActive(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * userID	是	int	用户id
     oldPhone	是	string	原有的手机号
     newPhone	是	string	更换的手机号
     msgCode	是	string	验证码
     * @return
     */
    public static Observable<ResultData<BindPhoneInfo>> bindPhone(String userID, String oldPhone, String newPhone, String msgCode){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.BIND_PHONE)
                .append("userID",userID)
                .append("newPhone",newPhone)
                .append("msgCode",msgCode);
        if(!TextUtils.isEmpty(oldPhone)){
            builder .append("oldPhone",oldPhone);
        }
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).bindPhone(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 获取评论列表
     * @param userId
     * @param id
     * @param type
     * @param pageNo
     * @return
     */
    public static Observable<ResultData<ArrayList<CommentBean>>> getComment(String userId, String id,String type, int pageNo){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_COMMENT)
                .append("userId",userId)
                .append("id",id)
                .append("type",type)
                .append("pageNo",pageNo)
                .append("pageSize",PAGE_SIZE);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getComment(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
    /**
     * 获取圈子八卦
     * @param userId
     * @return
     */
    public static Observable<ResultData<MyDynamicInfo>> getMyDynamic(String userId, String lookUserID){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_MYDYNAMIC)
                .append("userID",userId)
                .append("lookUserID",lookUserID);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getMyDynamic(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }


    /**
     * 附近小区
     * @param longitude 经度
     * @param latitude 纬度
     * @param pageNo 页码
     * @return
     */
    public static Observable<ResultData<ArrayList<Village>>> getNearbyHousing(double longitude, double latitude, int pageNo){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_NEARBY_HOUSING)
                .append("longitude",longitude)
                .append("latitude",latitude)
                .append("pageNo",pageNo)
                .append("pageSize",PAGE_SIZE);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getNearbyHousing(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 搜索小区
     * @param housingName
     * @return
     */
    public static Observable<ResultData<ArrayList<Village>>> searchHousing(String cityName,String housingName){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.SEARCH_HOUSING)
                .append("cityName",cityName)
                .append("housingName",housingName);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).searchHousing(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 小区用户
     * @param housingID
     * @param userID
     * @return
     */
    public static Observable<ResultData<ArrayList<VillageNeighbor>>> getHousingUserList(String housingID, String userID){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.HOUSING_USER_LIST)
                .append("housingID",housingID)
                .append("userID",userID);
//        if (!TextUtils.isEmpty(userName)) {
//            builder.append("userName",userName);
//        }
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getHousingUserList(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 圈子
     * @param userID
     * @param startIndex
     * @return
     */
    public static Observable<ResultData<ArrayList<Circle>>> getFriendCircleList(String userID, int startIndex){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_FRIEND_CIRCLE_LIST)
                .append("userID",userID)
                .append("startIndex",startIndex)
                .append("rows",PAGE_SIZE);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getFriendCircleList(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
    public static Observable<ResultData<ArrayList<Circle>>> getCircleList(String userID,String lookUserID, int startIndex,int pageSize){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_CIRCLE_LIST)
                .append("userID",userID)
                .append("lookUserID",lookUserID)
                .append("startIndex",startIndex)
                .append("rows",pageSize);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getFriendCircleList(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
    /**
     * 个人圈子
     * @param userID 需要查看的用户的ID
     * @param lookUserID 当前登录id
     * @param startIndex
     * @return
     */
    public static Observable<ResultData<ArrayList<Circle>>> getCircleList(String userID,String lookUserID, int startIndex){

        return getCircleList(userID,lookUserID,startIndex,PAGE_SIZE);
    }

    /**
     * 通讯录
     * @param userID
     * @return
     */
    public static Observable<ResultData<ArrayList<Contact>>> getFriendList(String userID,String housingID){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_FRIEND_LIST)
                .append("userID",userID)
                .append("housingID",housingID);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getFriendList(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 聊天群
     * @param userID
     * @return
     */
    public static Observable<ResultData<GroupList>> myGroup(String userID,String housingId){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_MY_GROUP)
                .append("userID",userID)
                .append("housingId",housingId);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).myGroup(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 建群
     * @param userID
     * @param housingID
     * @param groupName
     * @param groupLabel
     * @param groupImg
     * @param groupInfo
     * @return
     */
    public static Observable<ResultData<Group>> createGroup(String userID,String housingID
            ,String groupName,String groupLabel,String groupImg,String groupInfo){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_CREATE_GROUP)
                .append("userID",userID)
                .append("housingID",housingID)
                .append("groupName",groupName)
                .append("groupLable",groupLabel)
                .append("groupImg",groupImg)
                .append("groupInfo",groupInfo);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).createGroup(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 搜索用户
     * @param userID
     * @param userAccount
     * @return
     */
    public static Observable<ResultData<ArrayList<SearchUser>>> searchUser(String userID, String userAccount){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.SEARCH_USER)
                .append("userID",userID)
                .append("userAccount",userAccount);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).searchUser(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 发布评论
     * @param userId
     * @param externalType
     * @param externalID
     * @param content
     * @param isanonymity
     * @return
     */
    public static Observable<ResultData<Comment>> addComment(String userId, String externalType, String externalID,String parentID, String content, int type,String isanonymity,String commentId){
//        content = StringToUtils.URLEncode(content);
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.ADD_COMMENT)
                .append("userID",userId)
                .append("externalType",externalType)
                .append("externalID",externalID)
                .append("content",content)
                .append("type",type)
                .append("isanonymity",isanonymity);
        if (!TextUtils.isEmpty(parentID)) {
            builder.append("parentID",parentID);
        }
        if (!TextUtils.isEmpty(commentId)) {
            builder.append("commentId",commentId);
        }
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).addComment(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
    /**
     * 发布评论
     * @param userId
     * @param externalType
     * @param externalID
     * @param content
     * @param isanonymity
     * @return
     */
    public static Observable<ResultData<Comment>> addOtherComment(String userId, String externalType, String externalID,String parentID, String content, int type,String isanonymity,String commentId){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.ADD_COMMENT)
                .append("userID",userId)
                .append("externalType",externalType)
                .append("externalID",externalID)
                .append("content",content)
                .append("type",type)
                .append("isanonymity",isanonymity);
        if(!TextUtils.isEmpty(commentId)&&!"-1".equals(commentId)){
            builder.append("commentId",commentId);
        }
        if(!TextUtils.isEmpty(parentID)&&!"-1".equals(parentID)){
            builder.append("parentID",parentID);
        }
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).addComment(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 点赞
     * @param userId
     * @param externalType 类型（A:八卦，B:吐槽，C:圈子，D活动,F新闻，E小区公告）
     * @param id
     * @return
     */
    public static Observable<ResultData<LikeData>> clickPraise(String userId, String externalType, String id){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.CLICK_PRAISE)
                .append("userId",userId)
                .append("externalType",externalType)
                .append("id",id);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).clickPraise(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 群组详情
     * @param userId
     * @param groupID
     * @return
     */
    public static Observable<ResultData<Group>> groupInfo(String userId, String groupID){
        return groupInfo(userId,groupID,0);
    }

    public static Observable<ResultData<Group>> groupInfo(String userId, String groupAccount,int type){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_GROUP_INFO)
                .append("userID",userId);
        if (type == 1) {
            builder.append("groupAccount", groupAccount);
        } else {
            builder.append("groupID",groupAccount);
        }
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).groupInfo(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 快递领物
     * @param housingId
     * @param userId
     * @param status 状态（0，未领取；1，已领取）
     * @param pageNo
     * @return
     */
    public static Observable<ResultData<ArrayList<MyLeadMaterial>>> getExpress(String housingId, String userId, int status, int pageNo){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_EXPRESS)
                .append("userId",userId)
                .append("housingId",housingId)
                .append("status",status)
                .append("pageNo",pageNo)
                .append("pageSize",PAGE_SIZE);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getExpress(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 报修记录
     * @param housingId
     * @param userId
     * @param pageNo
     * @return
     */
    public static Observable<ResultData<ArrayList<RepairRecord>>> getRepair(String housingId, String userId, int pageNo){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_REPAIR)
                .append("userId",userId)
                .append("housingId",housingId)
                .append("pageNo",pageNo)
                .append("pageSize",PAGE_SIZE);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getRepair(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 添加通讯录好友
     * @param userID
     * @param phoneList
     * @return
     */
    public static Observable<ResultData<ArrayList<Contact>>> getNewFriendsByContacts(String userID, String phoneList){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_CONTACT_FRIENDS)
                .append("phones",phoneList)
                .append("userID",userID);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getNewFriendsByContacts(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 新的好友
     * @param userID
     * @param startIndex
     * @return
     */
    public static Observable<ResultData<ArrayList<NewFriend>>> getNewFriends(String userID, int startIndex){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_NEW_FRIENDS)
                .append("startIndex",startIndex)
                .append("rows",PAGE_SIZE)
                .append("userID",userID);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getNewFriends(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     *
     * @param id
     * @param type
     * @return
     */
    public static Observable<ResultData<JsonObject>> delSpoke(String id,String type){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.DEL_SPOKE)
                .append("id",id)
                .append("externalType",type);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     *
     * @param id
     * @param userID
     * @return
     */
    public static Observable<ResultData<Circle>> circlesInfo(String id,String userID){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_CIRCLES_INFO)
                .append("circlesID",id)
                .append("userID",userID);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).circlesInfo(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 赞扬或者批评
     * @param companyId 物业公司id
     * @return
     */
    public static Observable<ResultData<JsonObject>> getPraiseOrCriticize(String companyId){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_PRAISE_OR_CRITICIZE)
                .append("companyId",companyId);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 提交表扬或者批评
     * @param companyId 物业公司id
     * @param userId
     * @param evaluateType 评价类型（0，赞；1，踩）
     * @param message 留言内容
     * @return
     */
    public static Observable<ResultData<JsonObject>> addPraiseOrCriticize(String companyId,String userId,int evaluateType,String message){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.ADD_PRAISE_OR_CRITICIZE)
                .append("companyId",companyId)
                .append("evaluateType",evaluateType)
                .append("userId",userId);
        if (!TextUtils.isEmpty(message)) {
            builder.append("message",message);
        }
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     *
     * @param housingId
     * @param userId
     * @param pageNo
     * @return
     */
    public static Observable<ResultData<PropertyHome>> getTenement(String housingId, String userId, int pageNo){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_TENEMENT)
                .append("userId",userId)
                .append("housingId",housingId)
                .append("pageNo",pageNo)
                .append("pageSize",PAGE_SIZE);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getTenement(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     *
     * @param userId
     * @param applyId
     * @param content
     * @return
     */
    public static Observable<ResultData<JsonObject>> applyFriend(String userId, String applyId, String content){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.APPLY_FRIEND)
                .append("userId",userId)
                .append("applyId",applyId)
                .append("content",content);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 处理好友申请
     * @param userId
     * @param status // 状态（1：申请通过 2，申请不通过，3删除
     * @param id 申请记录的id
     * @return
     */
    public static Observable<ResultData<JsonObject>> disposeApplyFriend(String userId, int status, String id){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.DISPOSE_APPLY_FRIEND)
                .append("userId",userId)
                .append("status",status)
                .append("id",id);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 群组-申请通过
     * @param applyID 申请记录id
     * @return
     */
    public static Observable<ResultData<JsonObject>> processApply(String applyID){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.PROCESS_APPLY_GROUP)
                .append("applyID",applyID);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 建议献策
     * @param userId
     * @param companyId
     * @param content
     * @param imgList
     * @return
     */
    public static Observable<ResultData<JsonObject>> addProposal(String userId, String companyId, String content,String imgList){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.ADD_PROPOSAL)
                .append("userId",userId)
                .append("companyId",companyId)
                .append("content",content);
        if (!TextUtils.isEmpty(imgList)) {
            builder.append("imgList",imgList);
        }
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     *
     * @param userId
     * @param companyId
     * @param content
     * @param imgList
     * @return
     */
    public static Observable<ResultData<JsonObject>> addBoss(String userId, String companyId, String content,String imgList){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.ADD_BOSS)
                .append("userId",userId)
                .append("companyId",companyId)
                .append("content",content);
        if (!TextUtils.isEmpty(imgList)) {
            builder.append("imgList",imgList);
        }
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 圈子新消息
     * @param userId
     * @param startIndex
     * @return
     */
    public static Observable<ResultData<ArrayList<CircleMessage>>> circleNewMsg(String userId, int startIndex){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.CIRCLE_NEW_MESSAGE)
                .append("userID",userId)
                .append("startIndex",startIndex)
                .append("rows",PAGE_SIZE);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).circleNewMsg(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 编剧群昵称
     * @param userId
     * @param groupID
     * @param groupNickName
     * @return
     */
    public static Observable<ResultData<JsonObject>> editGroupMember(String userId, String groupID,String groupNickName){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.EDIT_GROUP_NICK)
                .append("userID",userId)
                .append("groupID",groupID)
                .append("groupNickName",groupNickName);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<ResultData<JsonObject>> editGroupMsgSet(String userId, String groupID,int msgStatus){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.EDIT_GROUP_NICK)
                .append("userID",userId)
                .append("groupID",groupID)
                .append("msgStatus",msgStatus);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 申请进群
     * @param applyID 申请人ID
     * @param groupID 群组ID
     * @param content 申请理由
     * @return
     */
    public static Observable<ResultData<JsonObject>> applyGroups(String applyID, String groupID,String content,String account){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.APPLY_GROUPS)
                .append("applyID",applyID)
                .append("groupID",groupID)
                .append("content",content)
                .append("account",account);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 解散该群
     * @param userID 用户ID
     * @param groupID 群组ID
     * @return
     */
    public static Observable<ResultData<JsonObject>> disbandGroup(String userID, String groupID){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.DISBAND_GROUP)
                .append("userID",userID)
                .append("groupID",groupID);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 可邀请好友列表
     * @param userID
     * @param groupID
     * @return
     */
    public static Observable<ResultData<ArrayList<User>>> getInviteUser(String userID, String groupID){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_INVITE_USER)
                .append("userID",userID)
                .append("groupID",groupID);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).getInviteUser(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 获取用户群组
     * @param userID
     * @return
     */
    public static Observable<ResultData<ArrayList<Group>>> userGroups(String userID){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.USER_GROUPS)
                .append("userID",userID);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).userGroups(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 邀请群成员
     * @param groupID
     * @param groupAccount
     * @param members
     * @return
     */
    public static Observable<ResultData<JsonObject>> inviteMember(String groupID,String groupAccount,String members){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.INVITE_MEMBER)
                .append("groupID",groupID)
                .append("groupAccount",groupAccount)
                .append("members",members);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 取消好友
     * @param userId
     * @param friendId
     * @return
     */
    public static Observable<ResultData<JsonObject>> cancelFriend(String userId,String friendId){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.CANCEL_FRIEND)
                .append("userId",userId)
                .append("friendId",friendId);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 物业报修
     * @param userId
     * @param housingId
     * @param remark
     * @param project
     * @param bespokeDate
     * @param imgList
     * @return
     */
    public static Observable<ResultData<JsonObject>> addRepair(String userId,String housingId,String remark,String project,String bespokeDate,String imgList){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.ADD_REPAIR)
                .append("userId",userId)
                .append("housingId",housingId)
                .append("remark",remark)
                .append("project",project)
                .append("bespokeDate",bespokeDate);
        if (!TextUtils.isEmpty(imgList)) {
            builder.append("imgList",imgList);
        }
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 退出群
     * @param userID
     * @param groupID
     * @param groupAccount
     * @return
     */
    public static Observable<ResultData<JsonObject>> removeGroupMember(String userID,String groupID,String groupAccount){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.REMOVE_GROUP_MEMBER)
                .append("userID",userID)
                .append("groupID",groupID)
                .append("groupAccount",groupAccount);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 编辑群资料
     * @param id
     * @param groupImg
     * @param groupInfo
     * @param groupName
     * @return
     */
    public static Observable<ResultData<JsonObject>> editGroup(String id,String groupImg,String groupInfo,String groupName){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.EDIT_GROUP)
                .append("id",id)
                ;
        if (!TextUtils.isEmpty(groupImg)) {
           builder .append("groupImg",groupImg);
        }
        if (!TextUtils.isEmpty(groupInfo)) {
            builder.append("groupInfo",groupInfo);
        }
        if (!TextUtils.isEmpty(groupName)) {
            builder.append("groupName",groupName);
        }
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     * 物业公司详情
     * @param companyId
     * @return
     */
    public static Observable<ResultData<JsonObject>> getCompanyInfo(String companyId){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.GET_COMPANY_INFO)
                .append("companyId",companyId);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }

    /**
     *清空新消息
     * @param userID
     * @return
     */
    public static Observable<ResultData<JsonObject>> clearCircleMsg(String userID){
        ParamsBuilder builder = ParamsBuilder.create()
                .append("server",API.CLEAR_CIRCLE_MSG)
                .append("userID",userID);
        String key=builder.build(encodeDes);
        Utils.systemErr(builder.build(encodeDes));
        return RRetrofit.getInstance().create(ApiService.class).baseJsonObjectRequest(key).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
    }
}